package exception;

import java.io.IOException;

/**演示异常抛出
 * */
public class Test {

    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws ExceptionOfIllegalAge {

        if (age<0||age>100){
            throw new ExceptionOfIllegalAge("年龄不合法异常");//抛出异常
        }
        this.age = age;
    }
}
